/*
 * @lc app=leetcode.cn id=744 lang=typescript
 *
 * [744] 寻找比目标字母大的最小字母
 */

// @lc code=start
function nextGreatestLetter(letters: string[], target: string): string {
    const final = letters.find((i) => {
        return i.charCodeAt(0) > target.charCodeAt(0);
    });
    if (final === undefined) {
        return letters[0];
    }
    return final;
}
// @lc code=end
